<?php require_once('Select_town/Connections/connection.php'); ?>
<?php
mysql_select_db($database_connection, $connection);
$query_rs_town = "SELECT * FROM tbl_town ORDER BY town_name ASC";
$rs_town = mysql_query($query_rs_town, $connection) or die(mysql_error());
?>

<!-- show clinic in beauty clinic -->
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("database");
mysql_query("SET NAMES UTF8");

if($_GET["Action"] == "Save")
{
	//*** Insert Reply ***//
	$strSQL = "INSERT INTO dr_ment ";
	$strSQL .="(dr_id,CreateDate,Time,Details,Name) ";
	$strSQL .="VALUES ";
	$strSQL .="('".$_GET["dr_id"]."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_POST["txtDetails"]."','".$_POST["name"]."' ) ";
	$objQuery = mysql_query($strSQL);

	//*** Update Reply ***//
	$strSQL = "UPDATE doctor";
	$strSQL .="SET Ment = Ment + 1 WHERE dr_id = '".$_GET["dr_id"]."' ";
	$objQuery = mysql_query($strSQL);	
	echo "<meta http-equiv ='refresh'content='0;URL=./doctorshow.php?dr_id=".$_GET["dr_id"]." '>";
 }
 
if($_GET["Action"] == "Delete")
{	
 	$strSQL =  "DELETE  FROM clinic_ment WHERE  Name = '".$_COOKIE["USER"]."' ";
	$objQuery = mysql_query($strSQL);
	echo "<meta http-equiv ='refresh'content='0;URL=./doctorshow.php?dr_id=".$_GET["dr_id"]." '>";
}
?>
 
 
<!-- show doctor in beauty clinic -->
<?   
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("database");
mysql_query("SET NAMES UTF8");
$strSQL = "SELECT * FROM doctor " ;
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>

 
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("database");
$strSQL2 = "SELECT * FROM doctor ";
$objQuery2 = mysql_query($strSQL2) or die ("Error Query [".$strSQL2."]");
$Num_Rows = mysql_num_rows($objQuery);

$Per_Page = 4;   // Per Page

$Page = $_GET["Page"];
if(!$_GET["Page"])
{
	$Page=1;
}

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
	$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
	$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
	$Num_Pages =($Num_Rows/$Per_Page)+1;
	$Num_Pages = (int)$Num_Pages;
}

$strSQL .=" order  by clinic_id DESC LIMIT $Page_Start , $Per_Page";
$objQuery  = mysql_query($strSQL);
?>



<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title> BeautyClinic  </title>

<!-- Linking styles -->
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />

<!--  jQuery Sidebar Sliding Tab Menu Tutorial  -->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js'></script>
<script src="js/jquery/tabbedContent.js" type="text/javascript"></script>
    

<!-- Start ------ Select Zone Town Amphur -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
 	$("#town_id").change(function(){
	
		var url = "Select_town/amphur.php?town_id="+$(this).val() ;

		$.getJSON(
				url ,
				function(resp){
					var opt = "<option value='0'>-- อำเภอ --</option>";
					
					for(var i=0;i<resp.length;i++){
						opt += "<option value='"+ resp[i].amphur_id+"'>"+resp[i].amphur_name+"</option>";
					}
					$("#amphur_id").html( opt );
				} 
		);
	});
})
</script>
<script type="text/javascript">
$(function(){
 	$("#amphur_id").change(function(){
	
		var url = "Select_town/tambon.php?amphur_id="+$(this).val() ;

		$.getJSON(
				url ,
				function(resp){
					var opt = "<option value='0'>-- ตำบล --</option>";
					
					for(var i=0;i<resp.length;i++){
						opt += "<option value='"+ resp[i].tambon_id+"'>"+resp[i].tambon_name+"</option>";
					}	
					$("#tambon_id").html( opt );
				} 
		);
	});
})
</script>
<!-- End ------ Select Zone Town Amphur -->



 </head>

<body>

<?
//*** Select Question ***//
$strSQL = "SELECT * FROM doctor  WHERE dr_id = '".$_GET["dr_id"]."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$objResult = mysql_fetch_array($objQuery);

//*** Update View ***//
$strSQL = "UPDATE webboard ";
$strSQL .="SET View = View + 1 WHERE dr_id = '".$_GET["dr_id"]."' ";
$objQuery = mysql_query($strSQL);	
?>


<!-- Menu -->
    <header>
    <div class="marg">
        <div class="header">
 
	<!--  START Header -->
	<div id="Header">
			<!-- Start: page-top --> 	
			<div id="page-top"> </div>
			<!-- End: page-top -->
		<div class="clear">&nbsp;</div>
	</div>
	<!-- End: Header -->
	

<!--  START nav-outer-repeat -->
<div class="nav-outer-repeat"> 

<!-- START ........................................................................................................................ START MAIN-->
<div id ="main">

	<!--  start nav-outer -->
	<div class="nav-outer"> 

		<!-- start nav-right -->
		<div id="nav-right">	
				<? if(isset($_COOKIE["USER"]) == false){ ?>
					<div class="nav-divider-right">&nbsp;</div>

 					 <a href="./login.php"><img src="images/shared/login.png" alt="" /></a> 

					<div class="nav-divider-right">&nbsp;</div>

					 <a href="./signup.php"> <img src="images/shared/signup.png" alt="" /></a> 
		 
 					<div class="nav-divider-right">&nbsp;</div>
                <? } 
				
				else{ ?>
					<div id="member-form">
						<div class="nav-divider-right">&nbsp;</div>

  						<a href="./logout.php"> <img src="images/shared/logout.png" alt="" /> </a> 
	
  						<div class="nav-divider-right">&nbsp;</div>
	
 						<div class="member-bar-form"><a>  ยินดีต้อนรับ คุณ  <u>  <?=$_COOKIE["USER"]?>    </u>  </a>  </div>
				  
						 <div class="nav-divider-right">&nbsp;</div>
					</div>
            <? } ?>
 
				<div class="clear">&nbsp;</div>		 
		</div> <!--  END nav-right -->


		<!--  start nav left-->
		<div class="nav">
		<div class="table">
				<div class="nav-divider">&nbsp;</div>
				
				<ul class="select"><li> <a href="./index.php"> <b> หน้าหลัก </b> </a> </li></ul>
				<div class="nav-divider">&nbsp;</div>
								
				<ul class="select"><li> <a href="./clinic.php"> <b> ศูนย์ศัลยกรรม </b> </a> </li></ul>
				<div class="nav-divider">&nbsp;</div>
			
				<ul class="current"><li><a href="./doctor.php"> <b> ศัลยแพทย์ </b> </a> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li> </ul>
				<div class="nav-divider">&nbsp;</div>
			
				<ul class="select"><li><a href="#nogo"> <b> รีวิวการศัลยกรรม </b> </a> </li> </ul>
				<div class="nav-divider">&nbsp;</div>		
				
				<ul class="select"><li><a href="#nogo"> <b> ศัลย์วาไรตี้ </b> </a> </li> </ul>
				<div class="nav-divider">&nbsp;</div>
	 
				<div class="clear"></div>
		</div> <!--  END table -->

				<div class="clear"></div>	
		</div> <!--  END nav -->

</div> <!--  ............. end main .............  -->

			<div class="clear"></div>
	</div> <!--  END nav-outer -->

</div>
<!--  END nav-outer-repeat -->





<!--  ..... start content-bg --- M A P .....  -->
<div id="content-bg">
<!-- 
<div id="map"><iframe width="100%" height="250" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=+%E0%B8%AD.%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B8%87%E0%B8%9E%E0%B8%B4%E0%B8%A9%E0%B8%93%E0%B8%B8%E0%B9%82%E0%B8%A5%E0%B8%81+%E0%B8%88.%E0%B8%9E%E0%B8%B4%E0%B8%A9%E0%B8%93%E0%B8%B8%E0%B9%82%E0%B8%A5%E0%B8%81+%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B9%80%E0%B8%97%E0%B8%A8%E0%B9%84%E0%B8%97%E0%B8%A2&amp;aq=t&amp;sll=16.816134,100.262389&amp;sspn=0.010578,0.018475&amp;ie=UTF8&amp;hq=&amp;hnear=Mueang+Phitsanulok,+Phitsanulok,+Thailand&amp;ll=16.819922,100.262500&amp;spn=0.010578,0.018475&amp;t=m&amp;z=15&amp;output=embed" ></iframe></div>

<div class="clear">&nbsp;</div>
 -->
</div>
<!--  ..... end content-bg --- M A P ..... -->




<!--  ............. START bar_map .............  
		<div id="bar_map">
				<div id="bar_map1"> </div>
		</div>
<!--  ............. END bar_map .............  -->




<!-- START ........................................................................................................................ START MAIN-->
<div id ="main">
							
  
<!-- start container -- จัดกลาง -->
<div id="page-bodyshow-nobg">
 
 
 
<table border=0>
<tr><td width=960px> <h4><a href="./doctor.php"> ศัลยแพทย์ </a> <img src="./images/img/next.png" />  ศัลยแพทย์<?=$objResult["dr_name"];?>  </h4> </td>  <td width=90px align=right>  <img src="./images/shared/facebook.png" /> </td>
</tr>
</table>
<hr width="auto"> <br>




<!--  START --- C o n t e n t --> 
<div id="content">

 
 
 

 <div id="doctor_show_left">   <!--  START --- S e a r c h --- left --> 

<? 
while($objResult2 = mysql_fetch_array($objQuery2))
{ 
?>	  	
   		<div class="side_doctor_show_left"> 		<!--  START --- D O C T O R -->             <a href="doctorshow.php?dr_id=<?=$objResult2["dr_id"];?>"> 
			<div class="sidebar_doctor_show_left">
				<ul>
					<img src="myfile/<?=$objResult2["dr_pic"];?>" class="img_doctor_show" />
				<li> <h3> <img src=" "  />ศัลยแพทย์ <?=$objResult2["dr_name"];?>   </h3> </li>
  				<li> <img src="./images/shared/review/clinic.png">  สถานที่ทำงาน <?=$objResult2["clinic_name"];?>    </li>
  				<li> พื้นที่ :  <?=$objResult2["clinic_tambon"];?>, <?=$objResult2["clinic_amphur"];?>                      </li>
				</ul>
			</div>        </a>
</div>  <!--  END --- D O C T O R --> 
 <? } ?>		

 		<div class="side_doctor_show_left"> 		<!--  START --- D O C T O R -->
 <?  
if($Prev_Page)
{
	echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'>ย้อนกลับ </a> ";
}

 for($i=1; $i<=$Num_Pages; $i++){
	if($i != $Page)
	{
		echo "  <a href='$_SERVER[SCRIPT_NAME]?Page=$i'> <u> $i  </u> </a>    ";
 	}
	else
	{
		echo "   <a> <b> $i </b> </a>";
 	}
}
if($Page!=$Num_Pages)
{
	echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'> ถัดไป</a> ";
}
mysql_close($objConnect);
?>  
    </div>  <!--  END --- D O C T O R -->

 </div>  <!--  end left -->


 


<div id="doctor_show_right">    <!--  START --- C o n t e n t --- right -->
  
 	<div class="side_doctor_show"> 	<!--  START --- Doctor SHOW etc -->	

 
  <div class="sidebar_doctor_show">    <!--  start sidebar_doctor_show etc -->
 			<ul>
 				<img src="myfile/<?=$objResult["dr_pic"];?>" class="img_doctor_show_right" />
<table border="0" > <tr> 
		<td  width="450px" valign="top">
			<table border="0" > 
				<tr> <td> <h2>  ศัลยแพทย์ <?=$objResult["dr_name"];?>   </h2> </td></tr>
  				<tr ><td height="15px">  </td></tr>
 			<tr> <td> <a href="clinicshow.php?clinic_id=<?=$objQuery3["clinic_id"];?>"> 	 <img src="./images/shared/review/clinic.png">  สถานที่ทำงาน <?=$objResult["clinic_name"];?>    </a>  </td></tr>
 	   				<tr ><td height="5px">  </td></tr>
 				<tr> <td> พื้นที่ :  ตำบล<?=$objResult["clinic_tambon"];?>  อำเภอ<?=$objResult["clinic_amphur"];?>      </td></tr>
			</table>
		</td>
 
		<td align="right" width="250px">
			<ul>
				<li> &nbsp;  </li>	<li> &nbsp; </li>	<li> &nbsp; </li> <li> &nbsp; </li> <li> &nbsp; </li> 
 				<li> vote 0 <img src="./images/shared/review/comment.png"> 0 reviews </li>
 			</ul>
		</td>
 </tr> 
</table>
</div>	  


<div class="sidebar_doctor_show">    <!--  start sidebar_doctor_show  -->

<div id="doctor_show_details">  
	<table border="0" > 
		<tr> 
			<td  width="120px" valign="top"> ประวัติการศึกษา 
 			</td>
 
			<td align="left" width="526px" valign="top">	<?=nl2br($objResult["dr_edu"]);?>
 			</td>
		 </tr> 
		 <tr><td> &nbsp; </td></tr>
		<tr> 
			<td  width="120px" valign="top"> ความเชี่ยวชาญพิเศษ 
 			</td>
 
			<td align="left" width="526px" valign="top">	 <?=nl2br($objResult["dr_specail"]);?>
 			</td>
		 </tr> 
	</table>
</div>							
 
<div id="doctor_show_details">  
	<table border="0" > 
		<tr> 
			<td  width="120px" valign="top"> รายละเอียดอื่น ๆ 
 			</td>
 
			<td align="left" width="526px" valign="top">	<?=nl2br($objResult["dr_pre"]);?>
 			</td>
		 </tr> 
	</table>
</div>	 




</div>	  <!--  end sidebar_doctor_show  -->

 

	</div>   <!--  End --- Doctor SHOW  -->	

</div>   <!--  End --- left -->	
 
 
 
 



 


  
 
 
 
 

 
 

</div>
<!--  end content -->

 

</div>
<!--  end container -->

  

<div class="clear">&nbsp;</div>


<div class="clear">&nbsp;</div>
    
<!-- start footer -->         
<div id="footer">
<!-- <div id="footer-pad">&nbsp;</div> -->
	<!--  start footer-left -->
	<div id="footer-left"> Contact : beautyclinic@info	
	  <a href="">BeautyClinic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>.</div>
	<!--  end footer-left -->
	<div class="clear">&nbsp;</div>
</div>
<!-- end footer -->
 

 
 </div>
<!-- END   ........................................................................................................................ END MAIN -->


</body>